package org.dromara.business.sensitive;

public class SensitiveWord {
    private final String word;
    private final int start;
    private final int end;

    public SensitiveWord(String word, int start, int end) {
        this.word = word;
        this.start = start;
        this.end = end;
    }

    public String getWord() {
        return word;
    }

    public int getStart() {
        return start;
    }

    public int getEnd() {
        return end;
    }

    @Override
    public String toString() {
        String wordStr = (word != null && !word.isEmpty()) ? word : "无";
        String startStr = (start >= 0) ? String.valueOf(start) : "N/A";
        String endStr = (end >= 0) ? String.valueOf(end) : "N/A";

        return String.format("命中词: [%s] | 位置: [%s - %s]", wordStr, startStr, endStr);
    }
}
